<template>
  <div class="wrapper">
   <swiper :options="swiperOption" v-if="showSwiper" >
    <!-- slides -->
    <swiper-slide v-for="item of list" :key="item.id">
      <img class="swiper-img" :src="item.imgUrl">
    </swiper-slide>
    <div class="swiper-pagination"  slot="pagination"></div>
   </swiper>
  </div>
</template>

<script>
// autoplay: true,
// speed: 2500,
// spaceBetween: 5000
// 配置参考 https://blog.csdn.net/mrliber/article/details/78819191
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: false,
        disableOnInteraction: false
      }
    }
  },
  computed: {
    showSwiper () {
      return this.list.length
    }
  }
}
</script>

<style lang="stylus" scoped>
  .wrapper >>> .swiper-pagination-bullet-active
     background: #fff !important
  @import '~styles/varibles.styl'
  .wrapper
    margin-bottom:.5rem
    width: 100%
    height:0
    padding-bottom: 25%
    .swiper-img
      width: 100%
</style>
